import Cookies from 'js-cookie'

// const domain = process.env.NODE_ENV === 'development' ? '' : '.instrument.com.cn'
const domain = '.instrument.com.cn'
const imListId = 'imListId'
const imShowId = 'imShowId'
const imListIdValId = 'imListIdValid'
const username = 'username'
const useid = 'useid'
const mobile = 'mobile'
const imToken = 'imtoken'

export function setImListId (data) {
  // console.log(data, '456')
  return Cookies.set(imListId, data, { domain: domain, expires: 30 })
}

export function getImListId () {
  return Cookies.get(imListId)
}

export function setImShowId (data) {
  return Cookies.set(imShowId, data, { domain: domain, expires: 30 })
}

export function getImShowId () {
  return Cookies.get(imShowId)
}

export function setImListIdValId (data) {
  return Cookies.set(imListIdValId, data, { domain: domain, expires: 30 })
}

export function getImListIdValId () {
  return Cookies.get(imListIdValId)
}

export function getUsername () {
  return Cookies.get(username)
}

export function setUseid (data) {
  return Cookies.set(useid, data, { domain: domain, expires: 30 })
}

export function getUseid () {
  return Cookies.get(useid)
}

export function setMobile (data) {
  return Cookies.set(mobile, data, { domain: domain, expires: 30 })
}

export function getMobile () {
  return Cookies.get(mobile)
}

export function getImToken () {
  return Cookies.get(imToken)
}

export function removeAllKey () {
  Cookies.remove('nickname', { domain: domain })
  Cookies.remove('platuserid', { domain: domain })
  Cookies.remove('plattype', { domain: domain })
  Cookies.remove('username', { domain: domain })
  Cookies.remove('Password', { domain: domain })
  Cookies.remove('useid', { domain: domain })
  Cookies.remove('userid', { domain: domain })
  Cookies.remove('IMSHowID', { domain: domain })
  Cookies.remove('IMListID', { domain: domain })
  Cookies.remove('imShowId', { domain: domain })
  Cookies.remove('imListId', { domain: domain })
  Cookies.remove('imListIdValid', { domain: domain })
  Cookies.remove('ListCheckValid', { domain: domain })
  Cookies.remove('IMShowID_Group', { domain: domain })
  Cookies.remove('root', { domain: domain })
  Cookies.remove('imstep', { domain: domain })
  Cookies.remove('imtoken', { domain: domain })
  Cookies.remove('passwordValid', { domain: domain })
  Cookies.remove('mobileValid', { domain: domain })
  Cookies.remove('mobile', { domain: domain })
  Cookies.remove('userType', { domain: domain })
  Cookies.remove('username_guestbook', { domain: domain })
  Cookies.remove('CheckValid', { domain: domain })
  Cookies.remove('privacyVersion', { domain: domain })
}
